require 'find'
require 'fileutils'

namespace :db do
  desc "Add schema information (as comments) to all model files"
  task :annotate_all do
    model_dir = File.join(RAILS_ROOT, 'app/models')
    
    Find.find(model_dir) do |path|
      if FileTest.directory?(path)
        system("rake db:annotate POSITION='top' MODEL_DIR='#{path}'")    
      end
    end
  end
end
